package com.vhuomai.wechat.mapper;

import com.vhuomai.mybatis.mapper.auto.AutoMapper;
import com.vhuomai.mybatis.mapper.auto.OrderBy;
import com.vhuomai.wechat.entity.BaseWxMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author harris
 */
@Mapper
public interface WxMenuMapper extends AutoMapper<BaseWxMenu, Integer> {
    
    @OrderBy(value = "menu_order", desc = false)
    List<BaseWxMenu> findByMerchantNo(@Param("merchantNo") Integer merchantNo);
    
    @Select("select count(1) from base_wx_menu where merchant_no=#{merchantNo} and parent_id=#{parentId}")
    int findCount(@Param("merchantNo") Integer merchantNo, @Param("parentId") Integer parentId);
}
